const AUTH_KEY = "app_auth_user";

export function saveAuth(raw: unknown): void {
    try {
        localStorage.setItem(AUTH_KEY, JSON.stringify(raw));
    } catch {}
}

export function readAuth<T>(): T | null {
    try {
        const v = localStorage.getItem(AUTH_KEY);
        return v ? (JSON.parse(v) as T) : null;
    } catch {
        return null;
    }
}

export function clearAuth(): void {
    try {
        localStorage.removeItem(AUTH_KEY);
    } catch {}
}


